package real.lang.reflect;

import java.util.HashMap;

public class RealTypeRelation {

	private String name;
	
	HashMap<String, HashMap<String, Boolean>> map = new HashMap<String, HashMap<String, Boolean>>();

	public boolean contains(RealType x, RealType y) {
		return this.contains(x.getName(), y.getName());
	}

	public boolean contains(String x, String y) {
		if (!this.map.containsKey(x))
			return false;
		if (!this.map.get(x).containsKey(y))
			return false;
		return map.get(x).get(y);
	}

	public void set(RealType x, RealType y) {
		this.set(x.getName(), y.getName(), true);
	}

	public void set(RealType x, RealType y, Boolean value) {
		this.set(x.getName(), y.getName(), value);
	}

	public void set(String x, String y) {
		this.set(x, y, true);
	}

	public void set(String x, String y, Boolean value) {
		if (!this.map.containsKey(x))
			map.put(x, new HashMap<String, Boolean>());
		this.map.get(x).put(y, value);
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	public RealTypeRelation(String name) {
		this.name = name;
	}
	
}
